package com.atguigu.Controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;
import java.util.concurrent.TimeUnit;

@RestController
@Slf4j
public class GracefulShutdownController {
    @GetMapping("/graceful")
    public String  shutdown() throws InterruptedException {
        log.info("进入优雅停机案例controller：{},业务运行需要10秒");

        TimeUnit.SECONDS.sleep(10);

        String retValue = "业务处理完成，订单流水号为："+ UUID.randomUUID().toString();
        log.info("运行结果：{}",retValue);



        return retValue;
    }

}
